package com.leonardo.persistenceme.model.persistancehandlers;

import java.io.DataInputStream;
import java.io.IOException;

import com.leonardo.persistenceme.Class2Handler;

public class BooleanArrayPersistenceHandler extends ArrayPersistenceHandler {

	public BooleanArrayPersistenceHandler() {
		super(Class2Handler.getHandler(Boolean.class));
	}

	public Object recover(DataInputStream stream) throws IOException {
		int length = stream.readInt();
		if(length == 0)
			return null;
		Boolean[] array = new Boolean[length];
		for(int i = 0; i < length; i++)
			array[i] = (Boolean) primitiveHandler.recover(stream);
		return array;
	}

}
